<link rel="stylesheet" href="/css/style.css">

<div id="settings">
  {% if is_admin and is_local%}
  <div class="setting">
    <h1>Datastore Settings</h1>
    <p>
      It appears Au-to-do is running locally. You may optionally reset the datastore contents.
      <button class="atd-button" onclick="datastoreReset();">Reset the datastore</button>
    </p>

    <script type="text/javascript">
      function datastoreReset() {
        $.ajax({
          url: '/ds_reset',
          type: 'POST'
        });
      }
    </script>
  </div>
  {% endif %}

  <div class="setting">
  <h1>Prediction Settings</h1>
    {% if is_admin %}
    <p>
      {% if credentials_email %}
      Au-to-do is currently using <strong>{{ credentials_email }}</strong>'s credentials.
      {% else %}
      <strong>No</strong> credentials currently in use for Au-to-do.
      {% endif %}
      {% ifequal current_user credentials_email %}
      <button class="atd-button" OnClick="Render.showGrantAccessWindow('prediction')">Refresh my credentials</button>
      {% else %}
      <button class="atd-button" OnClick="Render.showGrantAccessWindow('prediction')">Use my credentials</button>
      {% endifequal %}
    </p>
    {% endif %}

    <h2>Training Status</h2>
    <ul>
    {% for name,state in status.items %}
    <li>{{ name }} : {{ state }}</li>
    {% endfor %}
    </ul>
  </div>
</div>
